home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3062 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  47 lines

  1. Path: asmobj.larc.nasa.gov!jaapjl
  2. From: jaapjl@asmobj.larc.nasa.gov (Lee Jaap)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP! File Pointers
  5. Date: 25 Jan 1996 20:09:36 GMT
  6. Organization: probably not speaking for AS&M Inc
  7. Message-ID: <JAAPJL.96Jan25150936@asmobj.larc.nasa.gov>
  8. References: <4csr4c$fem@newsbf02.news.aol.com> <1996Jan9.083549.27165@zcon.com>
  9. Reply-To: J Lee Jaap <jaapjl@asmsun.larc.nasa.gov>
  10. NNTP-Posting-Host: asmobj.larc.nasa.gov
  11. In-reply-to: szh@zcon.com's message of Tue, 9 Jan 1996 08:35:49 GMT
  12.  
  13. In article <1996Jan9.083549.27165@zcon.com> szh@zcon.com (Syed Zaeem Hosain) writes:
  14. |>In article <4csr4c$fem@newsbf02.news.aol.com>, roberino@aol.com (Roberino) writes:
  15. |>>
  16. |>>Here are the steps I am performing:
  17. |>>
  18. |>>void main()
  19. |>
  20. [...]
  21. |>>        fgets(Line, File2); <----- As soon as this occurs, File1 gets
  22. |>>                                          wiped out.  Why?
  23. [...]
  24.  
  25. [Good advice about incorrect call of fgets deleted.]
  26.  
  27. |>I'd also suggect finding a better compiler - one that properly warns
  28. |>you about this error in the call.
  29.  
  30. Of course, you probably won't get any errors unless you include
  31. the header file that contains the prototype for fgets.
  32.  
  33. REMEMBER THE HEADER FILES!  Otherwise, the compiler takes your usage
  34. as a declaration.  In your case, the compiler guessed that fgets is
  35.    int fgets (char *, FILE *);
  36. which is not what the standard i/o library expects.
  37.  
  38. For example,
  39.  
  40. #include <stdio.h>
  41.  
  42. RTFM is always good advice.
  43. --
  44. J Lee Jaap <JaapJL@ASMSun.LaRC.NASA.Gov> +1 804/865-7093
  45.       employed by, not necessarily speaking for,
  46.             AS&M Inc, Hampton VA 23666-1340
  47.